#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <audio_ns.h>

int Ns_Process(NsHandle_t* h,short* spframe,short* outframe,int size)
{
	int i,j,k;
	float *sp = h->sp;
	float *out = h->out;
	const float *const *p = (const float* const*)&sp;
	float *const *q = &out;

	k = size/(h->cell_num*2);
	printf("k = %d\n",k);

	if (k == 0)
		return -1;
	for (i = 0;i < k;i++){
		for(j = 0;j < h->cell_num;j++){
			sp[j] = spframe[j+(i*h->cell_num)];
		}
		memset(out,0,h->cell_num*sizeof(float));
		audio_process_ns_process(h->handle,p,1,q);
 		for(j = 0;j < h->cell_num;j++){
			outframe[j+(i*h->cell_num)] = out[j];
		}
	}
	return 0;
}
